;(function($){
    "use strict";

    $.fn.goods2 = function(data){

        // this是要加轮播图的元素
        const that = this;

        // 根据数据，渲染页面结构
        init();

        function init(){
            let str = "";
            $.each(data, (idx, val)=>{
                str += `<div class="pMsgList">
                <img src="${val.src}" alt="${val.alt}">
                <div class="pTxt">
                    <p>${val.name}</p>
                    <p>${val.price}</p>
                </div>
                 </div>`;
            });
            $(str).appendTo(that);
        }
    }

})(jQuery);
